<?php

class Cff_Controller_Action extends  Zend_Controller_Action
{
    
    public function init()
    {
		parent::init();
		
		// 		var_dump(parent::getFrontController());exit;
		
		
		$this->view = Zend_Registry::get('CffView');
		$this->smarty = Zend_Registry::get('SmartyView');
		$this->tplDirectory = "order/order/";	//控制对应模板目录
		$this->view->page = 1;
		$this->view->pageSize =20;
		
		$this->module = strtolower(str_replace('-','',$this->_request->getModuleName()));
		$this->controller = strtolower(str_replace('-','',$this->_request->getControllerName()));
		$this->action = strtolower(str_replace('-','',$this->_request->getActionName()));
		
		$this->session = new Zend_Session_Namespace('userAuth');
		
		//改变模板文件位置
		$this->view->setScriptPath(APPLICATION_PATH."/modules/".$this->module."/views/");
// 		print_r($this->_request->getBaseUrl());exit;
		$this->view->baseUrl = $this->_request->getBaseUrl();

		Zend_Registry::get ( 'layout')->baseUrl = $this->_request->getBaseUrl();
		
		if($this->module!='default'){		
// 			if(!$this->session->userID){
// 				$this->_redirect('/default/index/login');
// 				exit();
// 			}
			/*
			 if (!Common_Service_Verfication::check($this->session->userID, $this->module, $this->controller, $this->action)){
		
			if($this->_request->isXmlHttpRequest()){
			$aOut['isAllow'] = 0;
			$aOut['permissonMsg'] = 'No permission to access.';
			echo json_encode($aOut);
			exit();
			}else{
			$this->_redirect('/default/index/nopermission');
			exit();
			}
		
			}
			*/
		}
    }

}
